﻿using TEngine;
using UnityEngine;

namespace Assets.GameScripts.Demo.FsmScene
{
    public class IdleState : FsmState<FsmDemo>
    {
        protected override void OnEnter(IFsm<FsmDemo> fsm)
        {
            Log.Debug("进入待机状态");
        }
        protected override void OnUpdate(IFsm<FsmDemo> fsm, float elapseSeconds, float realElapseSeconds)
        {
            /* 按W、S或者上下方向键移动 */
            float inputvertical = Input.GetAxis("Vertical");
            float inputHorizontal = Input.GetAxis("Horizontal");
            if (inputvertical != 0 || inputHorizontal != 0)
            {
                /* 移动 */
                ChangeState<MovingState>(fsm);
            }
        }
    }
}
